<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>游戏信息表</title>
    <style>
        table {
            width: 800px;
            border-collapse: collapse;
            position: absolute;
            margin-left: 100px;
            margin-top: 50px;
        }
        #add{
            display: block;
            position: relative;
            margin-right: 0;
        }
        th {
            background-color: #f2f2f2;
        }
        tr:nth-child(even) {
            background-color: #7092BE;
        }
        tr:nth-child(odd) {
            background-color: #ffffff;
        }
    </style>
</head>
<script type="application/javascript" src="js/jquery-3.7.1.js"></script>
<script type="application/javascript">
    $(function (){
        $(".del").click(function (){
            var id = $(this).data("id")
            $.ajax({
                url:"/info",
                data:{
                    action:"delInfo",
                    id:id
                },
                type:"GET",
                dataType:"json",
                success:function (data){
                    alert(data.msg);
                    location.href="/info?action=queryInfo";
                }
            })
        });

        $(".btn").click(function (){
            location.href="addInfo.jsp";
        })
    })
</script>
<body>
<h2>关键词信息表</h2>
<table border="1">
    <thead>
    <tr>
        <th>编号</th>
        <th>关键词名称</th>
        <th>业务类型</th>
        <th>创建时间</th>
        <th>操作</th>
    </tr>

    </thead>
    <tbody>
    <c:forEach var="info" items="${infoList}" varStatus="s">
        <tr>
            <td>${info.id}</td>
            <td>${info.name}</td>
            <td>${info.type}</td>
            <td>${info.date}</td>
            <td><a class="del" data-id="${info.id}" href="javascript:void(0)">删除</a></td>
        </tr>
    </c:forEach>
    </tbody>
</table>
<div>
    <button class="btn">添加关键词</button>
</div>
</body>
</html>
